﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DbCommon;
using System.Web.Services;
using Entity;
using System.Data;
using Web.UI;
namespace Web.frontpage.SignUp.right
{
    public partial class ConList:SignUpPage
    {
        protected string pagecount;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pagecount = Convert.ToString(SQLHelper.GetRecordCount("v_Contest", " CON_IsShow='2'"));
            }
        }
        /// <summary>
        /// 报名
        /// </summary>
        /// <param name="ConId"></param>
        /// <param name="form"></param>
        /// <returns></returns>
        [WebMethod]
        public static string SignUp(string ConId,string form)
        {
            BoParticipants model = new BoParticipants();
            model.PAR_STUDENTS = HttpContext.Current.Session["studentId"].ToString();
            model.PAR_CONTESTS = ConId;
            model.PAR_SPECIALTY = Convert.ToInt32(form);
            BLL.ParticipantService participant = new BLL.ParticipantService();
            //如果已经存在，那么就不允许其报名
            if (participant.CheckStuId(model) > 0)
            {
                return "{'resultJson':'您已报名，不允许重复报名'}";
            }
            else
            {
                participant.CreateParticipant(model);
                return "{'resultJson':'报名成功'}";
            }
        }
    }
}